<?php 
//get library
eval ("?>$library");
?>

<?php 
 //Set seo content
$seoData->setTitle("Tags " . $name . " -  " . $_SERVER['SERVER_NAME']);
$seoData->setDescription("Tags " . $name . ", a free article directory. Author and submit your articles for free distribution and find " . $name . " content for your website");
$seoData->setOgSiteName($_SERVER['SERVER_NAME']);
$seoData->setOgTitle("Tags " . $name . " -  " . $_SERVER['SERVER_NAME']);
$seoData->setOgDescription("Tags " . $name . ", a free article directory. Author and submit your articles for free distribution and find " . $name . " content for your website");
?>
            <div class="container">            	
                <div class="row-fluid">

                    <!-- main content
                    ================================================== -->
                    <div id="mainContent" class="span8">
                        <div id="mainContent_inner" itemscope itemtype="http://schema.org/ItemList">
                        	<h2>Tag: <?=$name?></h2>
                            <hr />
                        	<!-- Article listing
       						================================================== -->
                        	<meta itemprop="mainContentOfPage" content="true"/>
							<meta itemprop="itemListOrder" content="Descending" />
                            
                            <!-- Newest article
       						================================================== -->                            
       						<?php 
							foreach ($articles as $key => $article) {
							?>
                            <article class="" itemscope itemtype="http://schema.org/Article" itemprop="itemListElement">
                                <h3 class="articleTitle" itemprop="name"><a href="/article/<?=$article->getAlias()?>"><?=$article->getTitle()?></a></h3>
                                <div class="row-fluid">
                                        <div class="articleMeta clearafter">
                                        	<?php 
											$author = $authors[$article->getCreator()];
											$category = $categories[$article->getCategory()];
											if ($author === NULL) {
											?>
                                            <i class="icon-user"></i> <?=$article->getAuthorName()?>
                                            <?php 
											} else {
                                            ?>
                                            <a itemprop="author" href="/author/<?=$author->getId() ?>"><i class="icon-user"></i> <?=$author->getName()?> </a>
                                            <?php 
											}
                                            ?>
                                            | 
                                            <a href="/category/<?=$category === NULL ? "" : $category->getAlias() ?>"><i class="icon-folder-close"></i> <?=$category === NULL ? "" : $category->getName()?></a> 
                                            |
                                            <span itemprop="dateCreated"><i class="icon-calendar"></i> <?=date("M, d Y", $article->getCreated())?></span>                                    
                                            <meta content="UserComments:5" itemprop="interactionCount">
                                        </div>
                                        <div class="entry" itemprop="description">                                           
                                            <p><?=substr(trim(strip_tags($article->getContent())),0, 200)?></p>
                                        </div>
                                        <a href="/article/<?=$article->getAlias()?>" class="btn btn-small"><i class="icon-plus-sign"></i> Read more</a>
                                </div>
                            </article>
                            <?php
							} 
                            ?>
                            
                            <!-- Pagination
        					================================================== -->
                            <div class="pagination pagination-right">
                                <ul>
	                                <?php 
									$range = $paginator->getRangePage();
									?>
									<?php 
									if ($prevPage) {
									?>
                                	<li><a href="<?=$paginator->getPrev() ?>">Prev</a></li>
									<?php 
									}
									if ($nextPage || $prevPage) {
										for ($i = 0; $i < count($range); $i++) {
									 ?>
                                    <li class="<?=$range[$i] == $pages ? "disabled" : ""?>"><a href="<?=$paginator->getPage($range[$i])?>"><?=$range[$i] ?></a></li>
                                    <?php 
										}
									}
									if ($nextPage) {
									?>
									<li><a href="<?=$paginator->getNext() ?>">Next</a></li>
									<?php } ?>
                                </ul>
                            </div>
                        </div>
                    </div>

                    <!-- sidebar
                    ================================================== -->
                    <div class="span4">
                        <aside>
                        
                        	<!-- Search
        					================================================== -->
                        	<div class="module-2">
                                <h3 class="title">Search this site</h3>
                                <div class="moduleContent">
                                    <form method="get" action="/search" class="form-inline">
                                    	<input type="text" placeholder="Search article" class="" name="q"  />
                                        <button type="submit" class="btn">Search</button>
                                    </form>
                                </div>
                            </div>
                            
                            <!-- Adv
        					================================================== -->
                            <div class="module-2">                                
                                <div class="moduleContent adv-sidebar">
                                    <!-- Adv adsense BEGIN -->
                                    <script type="text/javascript"><!--
									google_ad_client = "ca-pub-2883566427648799";
									/* 300x250 */
									google_ad_slot = "2688877886";
									google_ad_width = 300;
									google_ad_height = 250;
									//-->
									</script>
									<script type="text/javascript"
									src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
									</script>
                                    <!-- Adv adsense END -->
                                </div>
                            </div>
                            
                            <!-- Recent article
        					================================================== -->
                            <div class="module-6">
                                <h3 class="title">Recent article view</h3>
                                <div class="moduleContent">
                                    <ul class="listingStyle" itemscope itemtype="http://schema.org/ItemList">
                                    	<?php 
                                    	foreach ($lastestArticles as $key => $article) {
                                    	?>
                                    	<li itemscope itemtype="http://schema.org/Article" itemprop="itemListElement">
                                        	<h5 itemprop="name" class="articleTitle"><a href="/article/<?=$article->getAlias()?>" itemprop="url"><?=$article->getTitle()?></a></h5>
                                            <span itemprop="dateCreated"><?=date("M, d Y", $article->getCreated())?></span>
                                        </li>
                                        <?php 
                                    	}
                                        ?>
                                    </ul>
                                </div>
                            </div>
                            
                            <!-- Categories
        					================================================== -->
                            <div class="module-6">
                                <h3 class="title">Categories</h3>
                                <div class="moduleContent">
                                    <ul class="listingStyle" itemscope itemtype="http://schema.org/ItemList">
                                    	<?php
                                    	foreach ($lstCategories as $key => $category) { 
                                    	?>
                                    	<li itemprop="itemListElement"><i class="icon-share-alt"></i> <a itemprop="url" href="/category/<?=$category->getAlias()?>"><span itemprop="name"><?=$category->getName()?></span></a></li>
                                    	<?php } ?>
                                    </ul>
                                </div>
                            </div>
                            
                            <!-- Tags
        					================================================== -->
                            <div class="module-2">
                            	<h3 class="title">Tags</h3>                            
                                <div class="moduleContent" itemscope itemtype="http://schema.org/CreativeWork">
                                	<?php 
                                	foreach ($tags as $key => $tag) {
                                	?>
                                    <a href="/tag/<?=urlencode($tag)?>" class="label label-info" itemprop="keywords"><?=$tag?></a>
                                    <?php 
                                	}
                                    ?>
                                </div>
                            </div>
                        </aside>
                    </div>                                                
                </div>
            </div>
